package com.androiddev.br;

import java.util.zip.Inflater;

import com.androiddev.br.components.ImageButtonView;

import android.app.Activity;
import android.content.Context;
import android.graphics.Color;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

public class Main extends Activity {
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		LinearLayout l = (LinearLayout) findViewById(R.id.linearLayout1_ref);

		try {
			ImageButtonView t = (ImageButtonView) ImageButtonView.createButton(
					getApplicationContext(), "Clique aqui!");
			
			System.out.println("Foi aqui!");
//			ImageButtonView bv = (ImageButtonView) t;
			// View t = (View)
			// LayoutInflater.from(getApplicationContext()).inflate(
			// R.layout.common_buttonimage, null );

			System.out.println("Foi aqui!");
			if (l == null) {
				Log.d("t", "View é nula!");
			} else {
				l.addView(t, new LayoutParams(LayoutParams.WRAP_CONTENT,
						LayoutParams.WRAP_CONTENT));
			}

		} catch (Exception ex) {
			System.out.println(ex.toString());
		} finally {
			System.out.println( "terminou!" );
		}
	}
}